<template>
  <section class="jumbotron">
    <h3 class="jumbotron-heading">Search Github Users</h3>
    <div>
      <input
        type="text"
        placeholder="enter the name you search"
        ref="userName"
      />&nbsp;
      <button @click="handler">Search</button>
    </div>
  </section>
</template>

<script>
export default {
  name: "",
  props: ["getData"],
  methods: {
    //子组件的方法,按钮的回调函数
    handler() {
      let userName = this.$refs.userName.value;
      if (userName.trim() == "") return;
      //触发按钮的点击事件的时候，需要将用户输入进来的个关键字，传递给父组件
      this.getData(userName);
    },
  },
};
</script>

<style scoped>
</style>
